package thread.join;
/**
 * 线程的 join 方法
 * 强制执行当前的线程， 将进入到阻塞状态，yield会进入到就绪状态
 *
 * @author cyt
 * @create 2020-03-03 14:16
 */
public class Join {
    public static void main(String[] args) {
        Thread q = new Thread(new MyJoinThread(), "A");
        q.start();
        for (int i = 1; i <= 10; i++) {
            try {
                if (i == 5) {
                    q.join();
                }
                Thread.sleep(500);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
